#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         myName

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------

Global $advice

Func make_advice_l()
	make_advice(True)
EndFunc

Func make_advice($fl = False)
	Local $log = map_to_str($last_map) & @CRLF
	gen_advice($log,$fl)
EndFunc

Func gen_advice($nl = False,$fl = False)
	Local $map = $last_map
	Local $log = $nl
	$advice = find_variant($map,$log,$fl)
	If $nl Then
		store_log($log)
	EndIf
	If IsArray($advice)Then
		set_label("found " & UBound($advice,1) & " turns")
		For $v = 0 To UBound($advice,1) - 1
			If $v >= $adv_max Then ExitLoop
			;[$m,$g,$r,$c,$award]
			Local $var = $advice[$v]
			set_advice($v,$move[$var[0]][0], award_to_str($var[4]))
		Next
		For $v = UBound($advice,1) To $adv_max - 1
			set_advice($v,"")
		Next
	EndIf
EndFunc


Func show_advice($n)
	set_label("show: " & $n)
	Local $var = $advice[$n]
	Local $map = show_variant($var)
	set_label(award_to_str($var[4]))
	select_map($map)
EndFunc

Func apply_advice($n)
	set_label("apply: " & $n)
	Local $var = $advice[$n]
	Local $map = $last_map
	apply_variant($map,$var)
	set_label(award_to_str($var[4]))
	show_map($map)
EndFunc
